package teach.aistar.test;


import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import teach.aistar.mapper.*;
import teach.aistar.model.entity.*;
import teach.aistar.model.vo.AdminCarQueryVo;
import teach.aistar.service.ICarDetailService;

import java.util.Date;
import java.util.List;

@SpringBootTest
public class test {

    @Autowired
    private ICarDetailService iCarDetail;
    @Autowired
    private CarDetailMapper carDetailMapper;


    @Autowired
    private OrderDetailsMapper orderDetailsMapper;

    @Autowired
    private OrderMapper orderMapper;

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private UserDetailMapper userDetailMapper;

    @Autowired
    private CarBrandsMapper carBrandsMapper;

    @Autowired
    private  AdminMapper adminMapper;

    @Autowired
    private NoticeMapper noticeMapper;

    @Autowired
    private CarCartMapper carCartMapper;

   @Test
   public void admin()
   {
       Notice notice=new Notice();
       notice.setNoticeStatus(0);
       notice.setNoticeText("你好！！！！");
       notice.setNoticeTime(new Date());
       notice.setUserId(1);
       noticeMapper.insert(notice);


   }

    @Test
    public void test(){
        AdminCarQueryVo adminCarQueryVo=new AdminCarQueryVo();
       adminCarQueryVo.setBrandsId(5L);
        List<CarDetail> lists= carDetailMapper.findByConditional(adminCarQueryVo);
        System.out.println(lists.size());
    }
    @Test
    public void user(){
        List<User> userList=userMapper.findAll();
        System.out.println(userList);
    }

    @Test
    public void update()
    {
//        UserDetail userDetail=new UserDetail();
//        userDetail.setUname("李玲瑞");
//        List<UserDetail> userDetails = userDetailMapper.findByConditional(userDetail);
//
//        System.out.println(userDetails);

        List<CarBrands> carBrands = carBrandsMapper.selectAll();
        System.out.println(carBrands);
    }
    @Test
    public void deleteCar(){

        carCartMapper.updates(12,2);


    }

}
